493D - Vasya and Chess - CodeForces Solution


constructive algorithms games math *1700

Please click on ads to support us..

Python Code:

n = int(input())
if n % 2:
	print("black")
else:
	print("white")
	print("1 2")

C++ Code:

#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
using ll = long long;
using vb = vector<bool>;
using vvb = vector<vb>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
#define mp make_pair
#define fi first
#define se second
#define fr(n) for(int i=0;i<n;i++)
#define forn(i, n) for (int i = 0; i < (n); ++i)
#define forn1(i, n) for (int i = 1; i <= (n); ++i)
#define pb push_back
#define max(a,b) ((a)>(b)? (a):(b))
#define min(a,b) ((a)<(b)? (a):(b))
#define all(v) v.begin(),v.end()
#define rall(x) (x).rbegin(), (x).rend()

void print_vector(vector<int>v){
    for(int i=0;i<v.size();i++){
        cout<<v[i]<<" ";
    }
    cout<<endl;
}

void print_vector_pair(vector<pair<int,int>>v){
    for(int i=0;i<v.size();i++){
        cout<<v[i].first<<" "<<v[i].second<<" "<<endl;
    }
    cout<<endl;
}


const int N = (int)5*(1e5) + 10;
// const int N = 500005;
const int MOD = 1e8;
// const int N = 1001;

bool ok(vector<int>a){
    int n=a.size();
    if(n<=2) return true;
    if(n>=5) return false;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if((a[i]<=a[j] && a[j]<=a[k]) || (a[i]>=a[j] && a[j]>=a[k])) return false;
            }
        }
    }
    return true;
}


 void solve(){
    int n;
    cin>>n;
    if(n%2==0){
        cout<<"white"<<endl;
        cout<<"1 2"<<endl;
    }
    else cout<<"black"<<endl;
 }

signed main(){
    IOS
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif

    int tests;
    // cin>>tests;
    tests =1;
    while(tests--){
        solve();
    }
}


Comments

Submit
0 Comments
More Questions

580A- Kefa and First Steps
1472B- Fair Division
996A - Hit the Lottery
MSNSADM1 Football
MATCHES Playing with Matches
HRDSEQ Hard Sequence
DRCHEF Doctor Chef
559. Maximum Depth of N-ary Tree
821. Shortest Distance to a Character
1441. Build an Array With Stack Operations
1356. Sort Integers by The Number of 1 Bits
922. Sort Array By Parity II
344. Reverse String
1047. Remove All Adjacent Duplicates In String
977. Squares of a Sorted Array
852. Peak Index in a Mountain Array
461. Hamming Distance
1748. Sum of Unique Elements
897. Increasing Order Search Tree
905. Sort Array By Parity
1351. Count Negative Numbers in a Sorted Matrix
617. Merge Two Binary Trees
1450. Number of Students Doing Homework at a Given Time
700. Search in a Binary Search Tree
590. N-ary Tree Postorder Traversal
589. N-ary Tree Preorder Traversal
1299. Replace Elements with Greatest Element on Right Side
1768. Merge Strings Alternately
561. Array Partition I
1374. Generate a String With Characters That Have Odd Counts